package com.shruijin.wy.thread;

import com.shruijin.wy.thread.action.MathAction;
import com.shruijin.wy.thread.action.SimpleAction;
import com.shruijin.wy.thread.anno.SimpleThreadAnno;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;

import javax.annotation.Resource;


public class SimpleRunnable implements Runnable {

    Logger LOGGER  = LoggerFactory.getLogger(this.getClass());

    private ThreadLocal threadLocal = new ThreadLocal();

    private String value ;

    @Resource
    @Qualifier("action.simple")
    SimpleAction simpleAction;

    @Override
    public void run() {
        threadLocal.set("threadlocal value"+Thread.currentThread().getName());
        value= Thread.currentThread().getName();

        LOGGER.info(" {} ,is running!",Thread.currentThread().getName());
        //new SimpleAction().simpleaction(Thread.currentThread().getName());
        simpleAction.simpleaction(Thread.currentThread().getName());
        LOGGER.info(" threadlocal value {} ,value {}",threadLocal.get(),value);
    }
}
